package cn.movie.admin.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cn.movie.admin.service.InitService;
import cn.movie.admin.service.movieService;




@Controller
@RequestMapping(value="/appInterface")
public class InterfaceController {
	@Autowired
	movieService movieservice;
	
	
	//查询电影类型接口
	@RequestMapping(value="/selMovieType")
	@ResponseBody
	public Map selMovieType(){
		Map<String,Object> map=new HashMap<String,Object>();
		List list=movieservice.selMovieTypeList(null);
		map.put("list",list);
		return map;
	}
	
	//根据电影类型ID查询电影列表接口
	@RequestMapping(value="/selMovieListByMovieTypeId")
	@ResponseBody
	public Map selMovieListByMovieTypeId(@RequestParam(value="movieTypeId",required=false) String movieTypeId){
		Map<String,Object> map=new HashMap<String,Object>();
		List list=movieservice.selMovieByType(movieTypeId);
		map.put("list", list);
		return map;
	} 
	//根据电影Id查询电影详情接口
	@RequestMapping(value="/selMovieDetail")
	@ResponseBody
	public Map selMovieDetail(@RequestParam("movieId") String movieId){
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("detail",movieservice.selMovieById(movieId));
		
		return map;
	}
	
}

